package utils

import (
	"context"
	"github.com/go-redis/redis/v8"
	"time"
)

var redisClient *redis.Client

func init() {
	redisClient = redis.NewClient(&redis.Options{
		Addr:     "127.0.0.1:6379",
		Password: "",
		DB:       1,
	})
}

func RedisSet(key string) error {
	_, err := redisClient.Set(context.Background(), key, 1, 10*time.Minute).Result()
	if err != nil {
		return err
	}
	return nil
}
